<?php

/**
 *  后台继承类
 * @file   Admin.php  
 * @date   2016-8-23 19:45:21 
 * @author Zhenxun Du<5552123@qq.com>  
 * @version    SVN:$Id:$ 
 */

namespace app\index\controller;
use think\Loader;

class Message extends Common {

    public function index() {
        $where = [];
        $name = input('name');

        if($name){
            $where['B.true_name'] = ['like',"%{$name}%"];
        }
        $field = "A.*,B.true_name as from_username";
        $lists = db('message')->alias("A")
            ->join("cy_user B","A.from_uid=B.id","left")
            ->field($field)
            ->where($where)
            ->order('A.id desc')
            ->paginate(20);



        $this->assign('lists', $lists);

        $this->assign('name', $name);
        return $this->fetch();
    }




}
